<?php $this->renderPartial('application.views.account.__registerForm'); ?>

<div class="loginblock">
<?php if(Yii::app()->user->isGuest): ?>

    <?php $model=Yii::app()->user->model; ?>

    <h3 class="loginheader" title="<?php echo $model->loginBlockTitle; ?>">
        <span><?php echo Yii::t('account/customer','loginFormTitle') ?></span>
        <br />
        <span style="font-size:14px; text-transform:lowercase; font-weight:normal;"><?php echo Yii::t('account/customer','loginFormSubtitle') ?></span>
    </h3>

    <?php $form=$this->beginWidget('CActiveForm', array(
        'id'=>'login-form',
        'action'=>Yii::app()->createUrl('account/index/login'),
        'method'=>'post',
        'enableAjaxValidation'=>true,
        'clientOptions'=>array(
            'validateOnSubmit'=>true,
            'validateOnChange'=>false,
        ),
    )); ?>

    <?php echo CHtml::errorSummary(array($model)); ?>

    <?php echo $form->textField($model,'login',array(
        'placeholder'=>$model->getAttributeLabel('login'),
        'class'=>'loginput',
    )) ?>
    <?php echo $form->error($model,'login'); ?>

    <?php echo $form->passwordField($model,'password',array(
        'placeholder'=>$model->getAttributeLabel('password'),
        'class'=>'loginput',
    )) ?>
    <?php echo $form->error($model,'password'); ?>

    <div class="passrem">
        <?php echo $form->checkbox($model,'remember'); ?>
        <?php echo $model->getAttributeLabel('remember'); ?>
    </div>

    <?php echo CHtml::link(Yii::t('main','login'),'#',array(
        'class'=>'btnenter',
        'onclick'=>'$("#login-form").submit(); return false;',
    )); ?>

    <?php echo CHtml::link(Yii::t('account/customer','register'),'#',array(
        'class'=>'reglink',
        'data-id'=>Yii::app()->createUrl('account/index/register'),
        'onclick'=>'Main.openPopup($("#reg")); return false;',
    )); ?>
    <?php echo CHtml::link(Yii::t('account/customer','forgot'),Yii::app()->createUrl('account/index/forgot'),array(
        'class'=>'passlink',
    )); ?>

    <?php $this->endWidget(); ?>

<?php else: ?>

    <div class="logavatar">

        <img src="<?php echo Yii::app()->user->image; ?>" />

    </div> <!-- logavatar -->

    <div class="logright">

        <div class="logname"><?php echo Yii::app()->user->login; ?></div>

        <?php echo CHtml::link(Yii::t('main','personalOffice'),Yii::app()->createUrl('account/index'),array(
            'class'=>'cablink1',
        )); ?>

        <?php echo CHtml::link(Yii::t('main','logout'),Yii::app()->createUrl('account/index/logout'),array(
            'class'=>'btnenter',
        )); ?>

    </div> <!-- logright -->

<?php endif; ?>

</div> <!-- loginblock -->